From a62e01399dfaab60fd1872af6b4e368c8107a66a Mon Sep 17 00:00:00 2001 From: Rob Browning Date: Sun, 7 Apr 2013 20:20:09 -0500 Subject: [PATCH] Automatically compute upstream version in debian/rules. --- debian/rules | 5 ++++- debian/upstream-version | 22 ++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100755 debian/upstream-version diff --git a/debian/rules b/debian/rules index b1601ad6f92..7c96f92128d 100755 --- a/debian/rules +++ b/debian/rules @@ -38,7 +38,10 @@ pf := set -o pipefail # builddir.) # The official upstream version defined by AC_INIT in configure.in. -upstream_ver := 24.2 +upstream_ver := $(shell debian/upstream-version) +ifeq (,$(upstream_ver)) + $(error 'Unable to find upstream version number.') +endif # This must be the version that's actually used at runtime for things # like load-path. It may not be the same as the upstream version diff --git a/debian/upstream-version b/debian/upstream-version new file mode 100755 index 00000000000..e54db12bb20 --- /dev/null +++ b/debian/upstream-version @@ -0,0 +1,22 @@ +#!/usr/bin/perl -w + +use strict; +use English; + +open(my $config_file, '<', 'configure.ac') + or die "cannot open configure.ac: $!"; + +my $version = ''; +my $found_init = 0; +while (<$config_file>) +{ + if(/^AC_INIT\(emacs,\s*(\S+)\s*\)$/o) + { + $found_init and die 'found duplicate AC_INIT() in configure.ac'; + $version = $1; + $found_init = 1; + } +} + +$found_init or die 'no AC_INIT() found in configure.ac'; +print "$version\n"; -- 2.30.2